new Vue({
    el: '#app',
    data: {
        active: 1,
        tabActive: 0,
        tabs: [{
                title: '今日排行',
                list: [],
                loading: false,
                finished: false,
                page: 1,
                type: 1,
            }, {
                title: '历史排行',
                list: [],
                loading: false,
                finished: false,
                page: 1,
                type: 2,
            }]
    },
    mounted: function () {
        this.loading = false;
        this.main();
    },
    methods: {
        main: function () {
            var tab = this.tabs[this.tabActive];
            this.getRankData(tab);
        },
        onTabChange: function () {
            var tab = this.tabs[this.tabActive];
            tab.list = [];
            tab.page = 1;
            this.getRankData(tab);
        },
        getRankData: function (tab) {
            $http.get('/api/otc/rankinglist', { type: tab.type }).then(function (res) {
                var _a;
                (_a = tab.list).push.apply(_a, res.data.data);
            });
        }
    }
});
